JUNK="scanner.c assembler.tab.c assembler.output"

assembler: assembler.tab.c assembler.h scanner.c
	@g++ assembler.tab.c -lfl -Wall -o assembler

assembler.tab.c: assembler.y
	@bison --verbose assembler.y

scanner.c: scanner.lex
	@flex --lex-compat --outfile scanner.c scanner.lex

.PHONY: clean
clean:
	@for $$i in $(JUNK); do\
      if[ -f $$i ]; then\
        rm $$i;\
      fi

.PHONY: clean-all
clean-all: clean
	@if[ -f assembler ]; then rm assembler
